<html><head><title>ImageGadget</title></head>
<body bgcolor="#FFFFDF" link="#009999" vlink="#006666" alink="#006666">
<font face="Arial" size="2"><p align="center"><b><font size="4">ImageGadget()</font></b></p>
<p><b>Syntax</b></p><blockquote>
Result = <font color="#006666"><b>ImageGadget</b></font>(#Gadget, x, y, Width, Height, ImageID [, Flags])</blockquote>

</blockquote>
<b>Description</b><br><blockquote>

Creates an Image gadget in the current GadgetList. 

</blockquote><p><b>Parameters</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>#Gadget</i></td>
<td width="90%"> 
A number to identify the new gadget. <a href="../reference/purebasic_objects.html">#PB_Any</a> can 
be used to auto-generate this number. 

</td></tr>
<tr><td><i>x, y, Width, Height</i></td>
<td> 
The position and dimensions of the new gadget. 
<br>
<br>
The gadget adjusts its width and height to fit the displayed image. The specified width and height are only 
used when no image is displayed. 

</td></tr>
<tr><td><i>ImageID</i></td>
<td> 
The image to display. Use the <a href="../image/imageid.html">ImageID()</a> function to get the ID from an image. If this parameter 
is 0, then no image will be displayed. 

</td></tr>
<tr><td><i>Flags (optional)</i></td>
<td> 
Flags to modify the gadget behavior. It can be a combination of the following values: 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_Image_Border</font>: display a sunken border around the image.
  <font color="#924B72">#PB_Image_Raised</font>: display a raised border around the image.
</font></pre>

</td></tr>
</table>
</blockquote><p><b>Return value</b></p><blockquote>

Returns nonzero on success and zero on failure. If <font color="#924B72">#PB_Any</font> was used as the #Gadget parameter 
then the return-value is the auto-generated gadget number on success. 

</blockquote><p><b>Remarks</b></p><blockquote>

A 'mini help' can be added to this gadget using <a href="gadgettooltip.html">GadgetToolTip()</a>. 
<br>
<br>
- <a href="setgadgetstate.html">SetGadgetState()</a>: Change the current Image of the gadget. A valid ImageID can be easily 
obtained with the <a href="../image/imageid.html">ImageID()</a> function. 
If the ImageID is 0, then the image is removed from the gadget. <br>
<br>
The following events are supported through <a href="../window/eventtype.html">EventType()</a>: 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_EventType_LeftClick</font>
  <font color="#924B72">#PB_EventType_RightClick</font>
  <font color="#924B72">#PB_EventType_LeftDoubleClick</font>
  <font color="#924B72">#PB_EventType_RightDoubleClick</font>
  <font color="#924B72">#PB_EventType_DragStart</font>
</font></pre>
After a <font color="#924B72">#PB_EventType_DragStart</font> event, the <a href="../dragdrop/index.html">Drag & Drop library</a> can be used to start 
a Drag & Drop operation. 
<br>
<br>
If the support of more event types or double-buffering for regularly updated image contents 
is needed, then take a look at the <a href="canvasgadget.html">CanvasGadget()</a>. 

</blockquote><p><b>Example</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#006666">If</font></b> <font color="#006666">OpenWindow</font>(0, 0, 0, 245, 105, "ImageGadget", <font color="#924B72">#PB_Window_SystemMenu</font> | <font color="#924B72">#PB_Window_ScreenCentered</font>)
    <b><font color="#006666">If</font></b> <font color="#006666">LoadImage</font>(0, "map.bmp")    <font color="#006666">; change 2nd parameter to the path/filename of your image</font>
<font color="#006666">      ImageGadget</font>(0,  10, 10, 100, 83,<font color="#006666"> ImageID</font>(0))                      <font color="#006666">; imagegadget standard</font>
<font color="#006666">      ImageGadget</font>(1, 130, 10, 100, 83,<font color="#006666"> ImageID</font>(0), <font color="#924B72">#PB_Image_Border</font>)     <font color="#006666">; imagegadget with border</font>
    <b><font color="#006666">EndIf</font></b>
    <b><font color="#006666">Repeat</font></b> : <b><font color="#006666">Until</font></b> <font color="#006666">WaitWindowEvent</font>() = <font color="#924B72">#PB_Event_CloseWindow</font>
  <b><font color="#006666">EndIf</font></b>
</font></pre>
<br>
<p><img src="../HelpPictures/imagegadget.png"></p>

</blockquote><p><b>See Also</b></p><blockquote>

<a href="getgadgetstate.html">GetGadgetState()</a>, <a href="setgadgetstate.html">SetGadgetState()</a>, <a href="buttonimagegadget.html">ButtonImageGadget()</a>, <a href="../image/imageid.html">ImageID()</a>, <a href="canvasgadget.html">CanvasGadget()</a> 

</Blockquote><p><b>Supported OS </b><Blockquote>All</Blockquote></p><center><- <a href=ipaddressgadget.html>IPAddressGadget()</a> - <a href=index.html>Gadget Index</a> - <a href=isgadget.html>IsGadget()</a> ->

</body></html>